import re
text = """
照片信息
![Lili.png](https://www.baidu.com/lili.png)
![Tom.png](https://www.google.com/tom.png)
![Jerry.png](/home/jerry/picture/jerry.png)
格式化字符串
## H1
### H2
"""

# 需求,提取出所有人的图片地址
pattern = re.compile(r"!\[(\S+)\]\((\S+)\)")
matchs = pattern.findall(text)
for it in matchs:
    name,url = it
    print(it)
    print(f"name:{name}, url:{url}\n")

'''
('Lili.png', 'https://www.baidu.com/lili.png')
name:Lili.png, url:https://www.baidu.com/lili.png

('Tom.png', 'https://www.google.com/tom.png')
name:Tom.png, url:https://www.google.com/tom.png

('Jerry.png', '/home/jerry/picture/jerry.png')
name:Jerry.png, url:/home/jerry/picture/jerry.png

'''